﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import flash.events.*;
    import net.wooga.pets.loading.vos.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;

    public class BuyFoodCommand extends Command {

        public var event:InfoEvent;

        override public function execute():void{
            var _local1:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST, this.onResult);
            _local1.addRequest("buy_food");
            dispatch(_local1);
        }
        private function onResult(_arg1:ResultVO):void{
            var _local2:Object;
            if (_arg1.success){
                _local2 = _arg1.data.buy_food;
                dispatch(new InfoEvent(EventConstants.UPDATE_USER_DATA, null, {changes:_local2}));
            };
            dispatch(new Event(EventConstants.HANDLE_NEXT_AVATAR_ACTION));
        }

    }
}//package net.wooga.pets.controllers 
